/*
 * 
 */
function getCity(city_id, frm) {
    $.ajax({
        type: "GET",
        dataType: "json",
        url: getCityUrl,
        data: {
        },
        success: function (data) {
            var optionStr = "<option value=''>城市</option>";
            for (var i in data) {
                optionStr = optionStr + "<option value = '" + data[i].id + "'" + (city_id == data[i].id ? " selected" : "") + ">" + data[i].name + "</option>";
            }
            $("select[name='city_id']").html(optionStr);
            frm.render('select'); //刷新select选择框渲染
        }
    });
}
/*
 * 
 */
function getDistrict(city_id, district_id, frm) {
    $.ajax({
        type: "GET",
        dataType: "json",
        url: getDistrictUrl,
        data: {
            city_id: city_id
        },
        success: function (data) {
            var optionStr = "<option value=''>区县</option>";
            for (var i in data) {
                optionStr = optionStr + "<option value = '" + data[i].id + "'" + (district_id == data[i].id ? " selected" : "") + ">" + data[i].name + "</option>";
            }
            $("select[name='district_id']").html(optionStr);
            frm.render('select'); //刷新select选择框渲染
        }
    });
}

/*
 * 
 */
function changeCity(city_id, frm) {
    var optionStr = "<option value=''>区县</option>";
    if (city_id > 0) {
        $.ajax({
            type: "GET",
            dataType: "json",
            url: getDistrictUrl,
            data: {
                city_id: city_id
            },
            success: function (data) {
                var optionStr = "<option value=''>区县</option>";
                for (var i in data) {
                    optionStr = optionStr + "<option value = '" + data[i].id + "'>" + data[i].name + "</option>";
                }
                $("select[name=district_id]").html(optionStr);
                frm.render('select'); //刷新select选择框渲染
            }
        });
    } else {
        $("select[name=district_id]").html(optionStr);
        frm.render('select'); //刷新select选择框渲染
    }
}